import { createStore, applyMiddleware } from 'redux'
import thunk from 'redux-thunk'
import rootReducer from '../reducers'

const initialState = { }

const finalCreateStore = applyMiddleware(thunk)(createStore)

const store = finalCreateStore(rootReducer, initialState)

if (module.hot) {
  module.hot.accept('../reducers', () => {
    const nextRootReducer = require('../reducers')
    store.replaceReducer(nextRootReducer)
  })
}

export default store
